// 基础组件配置
export const basicComponents = [
  { 
    type: 'input', 
    label: '单行文本', 
    icon: 'Document',
    name: '',
    required: false,
    placeholder: '请输入',
    maxLength: 100,
    defaultValue: '',
    tips: '',
    group: 'basic',
    props: {
      clearable: true,
      showWordLimit: true,
      type: 'text'
    }
  },
  { 
    type: 'textarea', 
    label: '多行文本', 
    icon: 'Document',
    name: '',
    required: false,
    placeholder: '请输入',
    maxLength: 500,
    defaultValue: '',
    tips: '',
    group: 'basic',
    props: {
      rows: 4,
      showWordLimit: true,
      autosize: { minRows: 4, maxRows: 8 }
    }
  },
  { 
    type: 'number', 
    label: '数字', 
    icon: 'Document',
    name: '',
    required: false,
    defaultValue: '',
    min: null,
    max: null,
    step: 1,
    tips: '',
    group: 'basic',
    props: {
      controls: true,
      controlsPosition: 'right',
      precision: 0
    }
  },
  { 
    type: 'money', 
    label: '金额', 
    icon: 'Money',
    name: '',
    required: false,
    defaultValue: '',
    min: 0,
    max: 999999999,
    tips: '',
    group: 'basic',
    props: {
      precision: 2,
      controls: false,
      prefix: '¥'
    }
  },
  { 
    type: 'date', 
    label: '日期', 
    icon: 'Calendar',
    name: '',
    required: false,
    defaultValue: '',
    format: 'YYYY-MM-DD',
    tips: '',
    group: 'basic',
    props: {
      type: 'date',
      placeholder: '请选择日期',
      valueFormat: 'YYYY-MM-DD'
    }
  },
  { 
    type: 'time', 
    label: '时间', 
    icon: 'Timer',
    name: '',
    required: false,
    defaultValue: '',
    format: 'HH:mm:ss',
    tips: '',
    group: 'basic',
    props: {
      isRange: false,
      placeholder: '请选择时间'
    }
  }
]

// 高级组件配置
export const advancedComponents = [
  { 
    type: 'select', 
    label: '下拉选择', 
    icon: 'Select',
    name: '',
    required: false,
    options: [],
    multiple: false,
    defaultValue: '',
    tips: '',
    group: 'advanced',
    props: {
      clearable: true,
      filterable: true,
      placeholder: '请选择'
    }
  },
  { 
    type: 'radio', 
    label: '单选框组', 
    icon: 'Check',
    name: '',
    required: false,
    options: [],
    defaultValue: '',
    tips: '',
    group: 'advanced',
    props: {
      border: false,
      button: false
    }
  },
  { 
    type: 'checkbox', 
    label: '复选框组', 
    icon: 'Checked',
    name: '',
    required: false,
    options: [],
    defaultValue: [],
    tips: '',
    group: 'advanced',
    props: {
      border: false,
      button: false,
      min: 0,
      max: 999
    }
  },
  { 
    type: 'switch', 
    label: '开关', 
    icon: 'Switch',
    name: '',
    required: false,
    defaultValue: false,
    tips: '',
    group: 'advanced',
    props: {
      activeText: '是',
      inactiveText: '否',
      activeValue: true,
      inactiveValue: false
    }
  },
  {
    type: 'rate',
    label: '评分',
    icon: 'Star',
    name: '',
    required: false,
    defaultValue: 0,
    tips: '',
    group: 'advanced',
    props: {
      max: 5,
      allowHalf: false,
      showText: false,
      showScore: false
    }
  },
  {
    type: 'slider',
    label: '滑块',
    icon: 'Operation',
    name: '',
    required: false,
    defaultValue: 0,
    tips: '',
    group: 'advanced',
    props: {
      min: 0,
      max: 100,
      step: 1,
      showInput: true,
      range: false
    }
  }
]

// 布局组件配置
export const layoutComponents = [
  { 
    type: 'grid', 
    label: '栅格布局', 
    icon: 'Grid',
    columns: [
      { 
        span: 12, 
        list: [],
        offset: 0,
        push: 0,
        pull: 0,
        xs: { span: 24 },
        sm: { span: 12 },
        md: { span: 12 },
        lg: { span: 12 },
        xl: { span: 12 }
      },
      { 
        span: 12, 
        list: [],
        offset: 0,
        push: 0,
        pull: 0,
        xs: { span: 24 },
        sm: { span: 12 },
        md: { span: 12 },
        lg: { span: 12 },
        xl: { span: 12 }
      }
    ],
    group: 'layout',
    props: {
      gutter: 20,
      justify: 'start',
      align: 'top',
      tag: 'div',
      type: null
    },
    style: {
      padding: '20px',
      background: '#f5f7fa',
      borderRadius: '4px'
    },
    customClass: '',
    columnSettings: {
      showAddColumn: true,
      minColumns: 1,
      maxColumns: 4,
      columnOptions: [
        { label: '1列', value: 1, spans: [24] },
        { label: '2列', value: 2, spans: [12, 12] },
        { label: '3列', value: 3, spans: [8, 8, 8] },
        { label: '4列', value: 4, spans: [6, 6, 6, 6] }
      ]
    },
    responsive: true,
    draggable: true,
    resizable: true
  },
  { 
    type: 'divider', 
    label: '分割线', 
    icon: 'Remove',
    name: '',
    group: 'layout',
    props: {
      direction: 'horizontal',
      contentPosition: 'center',
      borderStyle: 'solid',
      borderColor: '#dcdfe6'
    },
    style: {
      margin: '20px 0'
    }
  },
  {
    type: 'card',
    label: '卡片布局',
    icon: 'Document',
    name: '',
    group: 'layout',
    list: [],
    props: {
      shadow: 'always',
      title: '标题',
      bodyStyle: {
        padding: '20px'
      },
      headerStyle: {
        padding: '12px 20px'
      }
    },
    style: {
      marginBottom: '20px'
    }
  }
]

// 上传组件配置
export const uploadComponents = [
  { 
    type: 'image', 
    label: '图片上传', 
    icon: 'PictureFilled',
    name: '',
    required: false,
    maxCount: 1,
    accept: 'image/*',
    tips: '',
    group: 'upload',
    props: {
      listType: 'picture-card',
      limit: 1,
      multiple: false,
      showFileList: true,
      drag: false
    }
  },
  { 
    type: 'file', 
    label: '文件上传', 
    icon: 'Folder',
    name: '',
    required: false,
    maxCount: 1,
    accept: '',
    tips: '',
    group: 'upload',
    props: {
      listType: 'text',
      limit: 1,
      multiple: false,
      showFileList: true,
      drag: true
    }
  }
]

// 特殊组件配置
export const specialComponents = [
  { 
    type: 'editor', 
    label: '富文本编辑器', 
    icon: 'Edit',
    name: '',
    required: false,
    defaultValue: '',
    tips: '',
    group: 'special',
    props: {
      height: 300,
      placeholder: '请输入内容'
    }
  },
  { 
    type: 'cascader', 
    label: '级联选择', 
    icon: 'Share',
    name: '',
    required: false,
    options: [],
    multiple: false,
    defaultValue: '',
    tips: '',
    group: 'special',
    props: {
      clearable: true,
      filterable: true,
      showAllLevels: true,
      collapseTags: true
    }
  },
  {
    type: 'table',
    label: '子表单',
    icon: 'Grid',
    name: '',
    required: false,
    columns: [],
    tips: '',
    group: 'special',
    props: {
      border: true,
      stripe: true,
      showHeader: true,
      maxHeight: 400
    }
  }
]

// 组件分组配置
export const componentGroups = [
  {
    title: '基础字段',
    components: basicComponents
  },
  {
    title: '高级字段',
    components: advancedComponents
  },
  {
    title: '布局字段',
    components: layoutComponents
  },
  {
    title: '上传字段',
    components: uploadComponents
  },
  {
    title: '特殊字段',
    components: specialComponents
  }
]

// 导出所有组件
export const allComponents = [
  ...basicComponents,
  ...advancedComponents,
  ...layoutComponents,
  ...uploadComponents,
  ...specialComponents
] 